﻿<div ng-init="currentTab='insights'" ng-include="'Views/Menu/NewsCalendarEventMenu.html'"></div>


<div>
    
    <div class="user-inputs">
        <button class="btn-green" ng-click="insightList.addInsight();">Add Insight</button><br /><br />
        
            <form>
                <select class="select-box" ng-model="insightList.filter.insightTopicId" title="Filter insights by topic" style="width: 32%;">
                    <option value="">Topic</option>
                    <option ng-repeat="topicname  in insightList.topicNames" value="{{topicname.id}}">{{topicname.name}}</option>
                </select>

                <select class="select-box" ng-model="insightList.filter.insightSectorId" title="Filter insights by acitivity sector" style="width: 32%;">
                    <option value="">Sector</option>
                    <option ng-repeat="sectorname  in insightList.sectorNames" value="{{sectorname.id}}">{{sectorname.name}}</option>
                </select>

                <input type="text" class="search-inp" placeholder="Search Insights" ng-model="insightList.filter.titlePart" style="width: 31%;" />
                <!--<input type="submit" class="search-btn" ng-click="insightList.search();" value="" />-->
            </form>
        <div class="clear">&nbsp;</div>
    </div>
    <br />

    
    <div ng-show="insightList.insightsPaged.totalItemsCount > 0">
        <div style="display: table; width: 81%; float: left;">
            <div class="table-row">
                <div class="table-head"><input type="checkbox" ng-model="insightList.selectAll"></div>
                
                <div class="table-head"><a href="">Publication title</a></div>
                <div class="table-head"><a href="">Date Added</a></div>
                <div class="table-head"><a href="">Added by</a></div>
                <div class="table-head"><a href="">Status</a></div>
                <div class="table-head"><a href="">Unpublished Date</a></div>
                
                <!--
                    <div class="table-head"><a href="" ng-click="insightList.changeOrderBy('TitleLowercase');" ng-class="insightList.orderByCol === 'TitleLowercase' ? (insightList.orderByColAsc ? 'sortable_up' : 'sortable_down') : null">Publication title</a></div>
                    <div class="table-head"><a href="" ng-click="insightList.changeOrderBy('DateCreated');" ng-class="insightList.orderByCol === 'DateCreated' ? (insightList.orderByColAsc ? 'sortable_up' : 'sortable_down') : null">Date Added</a></div>
                    <div class="table-head"><a href="" ng-click="insightList.changeOrderBy('AddedByUserNameLoweCase');" ng-class="insightList.orderByCol === 'AddedByUserNameLoweCase' ? (insightList.orderByColAsc ? 'sortable_up' : 'sortable_down') : null">Added by</a></div>
                    <div class="table-head"><a href="" ng-click="insightList.changeOrderBy('StatusTextLowercase');" ng-class="insightList.orderByCol === 'StatusTextLowercase' ? (insightList.orderByColAsc ? 'sortable_up' : 'sortable_down') : null">Status</a></div>
                    <div class="table-head"><a href="" ng-click="insightList.changeOrderBy('UnpublishedDate');" ng-class="insightList.orderByCol === 'UnpublishedDate' ? (insightList.orderByColAsc ? 'sortable_up' : 'sortable_down') : null">Unpublished Date</a></div>
                -->
                    
            </div>
            <div class="table-row" ng-repeat="item in insightList.insightsPaged.items">
                <div class="table-col"><input type="checkbox" ng-model="item.selected"></div>
                <div class="table-col">
                    <a href="" ng-click="insightList.editInsight(item.id);"
                       style="overflow:hidden; display: inline-block; max-width: 362px; text-overflow: ellipsis;"
                       title="{{item.title}}"> {{insightList.short50Chars(item.title)}}</a>
                </div>
                <div class="table-col">{{item.datePublished | date: 'MMM d, y'}}</div>
                <div class="table-col">{{item.addedByUserName}}</div>
                <!--<div class="table-col">maggie kenney</div>-->

                <div class="table-col"><span class="green">{{$parent.insightList.statusText[item.state]}}</span></div>
                <div class="table-col">{{item.dateUnPublished | date: 'MMM d, y'}}</div>
            </div>
        </div>
        <div style="display: table; width: 13%; float: left;">
            <div class="table-row">
                <div class="table-col sel-items">
                    <div class="title-sel-items">
                        Insights Selected: <span style="color: #24b1a8;">{{ insightList.getSelectedItems().length }}</span>
                    </div>
                    <br /><br />
                    <button class="btn-green" style="width: 120px;" ng-click="insightList.deleteInsights();">Delete Insights</button><br /><br />
                    <button class="btn-green" style="width: 120px;" ng-click="insightList.publishInsights();">Publish Insights</button>
                </div>
            </div>
        </div>
        <div class="clear">&nbsp;</div>
        <sustainalytics-pager></sustainalytics-pager>
    </div>

</div>